package com.eks.plus.query;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.eks.plus.entity.CiCinema;
import java.util.Date;

/**
 * <p>
 * 影院表
 * 查询条件类
 * </p>
 *
 * @author chenfh
 * @since 2021-01-07
 */
public class CiCinemaQueryBo{

	private QueryBoExt queryBoExt;

	/**
	 * 
	 */
	private Integer id;

	/**
	 * 影院编码
	 */
	private String code;

	/**
	 * 影院名称
	 */
	private String name;

	/**
	 * 内部编号,作用？
	 */
	private String mgCode;

	/**
	 * 联系人
	 */
	private String contactMan;

	/**
	 * 联系人手机号码
	 */
	private String mphone;

	/**
	 * 联系人固定电话
	 */
	private String tphone;

	/**
	 * 邮政编码
	 */
	private String postcode;

	/**
	 * 传真
	 */
	private String fax;

	/**
	 * 邮箱
	 */
	private String email;

	/**
	 * 影院地址
	 */
	private String address;

	/**
	 * 影院介绍
	 */
	private String intro;

	/**
	 * 所属组织编号
	 */
	private String orgCode;

	/**
	 * 所属公司名称
	 */
	private String company;

	/**
	 * 所属院线名称
	 */
	private String cinemas;

	/**
	 * 影院状态，1 营业  2测试 
	 */
	private String status;

	/**
	 * 创建人标识
	 */
	private String createUser;

	/**
	 * 创建时间
	 */
	private Date createTime;

	/**
	 * 修改人标识
	 */
	private String updateUser;

	/**
	 * 修改时间
	 */
	private Date updateTime;

	/**
	 * 同步时间
	 */
	private Date syncTime;

	/**
	 * 
	 */
	private String uid;

	/**
	 * 商户编号
	 */
	private String merchantCode;

	/**
	 * 商户密钥
	 */
	private String merchantKey;

	/**
	 * 
	 */
	private String usbkey;

	/**
	 * 
	 */
	private Date statusUpdateTime;

	/**
	 * 哈票地址
	 */
	private String hapiaoKey;

	/**
	 * 备用字段1
	 */
	private String key1;

	/**
	 * 
	 */
	private String key2;

	/**
	 * 
	 */
	private String key3;

	/**
	 * 开业时间
	 */
	private Date openTime;

	/**
	 * 所属城市代码
	 */
	private String areaCode;

	/**
	 * 所属城市名称
	 */
	private String areaName;


	/**
	 * 构建查询
	 * @return
	 */
	public QueryWrapper<CiCinema> buildQuery() {
		QueryWrapper<CiCinema> query = new QueryWrapper<>();

		if(id!=null){
			query.eq(CiCinema.ID,id);
		}
		if(code!=null){
			query.eq(CiCinema.CODE,code);
		}
		if(name!=null){
			query.eq(CiCinema.NAME,name);
		}
		if(mgCode!=null){
			query.eq(CiCinema.MG_CODE,mgCode);
		}
		if(contactMan!=null){
			query.eq(CiCinema.CONTACT_MAN,contactMan);
		}
		if(mphone!=null){
			query.eq(CiCinema.MPHONE,mphone);
		}
		if(tphone!=null){
			query.eq(CiCinema.TPHONE,tphone);
		}
		if(postcode!=null){
			query.eq(CiCinema.POSTCODE,postcode);
		}
		if(fax!=null){
			query.eq(CiCinema.FAX,fax);
		}
		if(email!=null){
			query.eq(CiCinema.EMAIL,email);
		}
		if(address!=null){
			query.eq(CiCinema.ADDRESS,address);
		}
		if(intro!=null){
			query.eq(CiCinema.INTRO,intro);
		}
		if(orgCode!=null){
			query.eq(CiCinema.ORG_CODE,orgCode);
		}
		if(company!=null){
			query.eq(CiCinema.COMPANY,company);
		}
		if(cinemas!=null){
			query.eq(CiCinema.CINEMAS,cinemas);
		}
		if(status!=null){
			query.eq(CiCinema.STATUS,status);
		}
		if(createUser!=null){
			query.eq(CiCinema.CREATE_USER,createUser);
		}
		if(createTime!=null){
			query.eq(CiCinema.CREATE_TIME,createTime);
		}
		if(updateUser!=null){
			query.eq(CiCinema.UPDATE_USER,updateUser);
		}
		if(updateTime!=null){
			query.eq(CiCinema.UPDATE_TIME,updateTime);
		}
		if(syncTime!=null){
			query.eq(CiCinema.SYNC_TIME,syncTime);
		}
		if(uid!=null){
			query.eq(CiCinema.UID,uid);
		}
		if(merchantCode!=null){
			query.eq(CiCinema.MERCHANT_CODE,merchantCode);
		}
		if(merchantKey!=null){
			query.eq(CiCinema.MERCHANT_KEY,merchantKey);
		}
		if(usbkey!=null){
			query.eq(CiCinema.USBKEY,usbkey);
		}
		if(statusUpdateTime!=null){
			query.eq(CiCinema.STATUS_UPDATE_TIME,statusUpdateTime);
		}
		if(hapiaoKey!=null){
			query.eq(CiCinema.HAPIAO_KEY,hapiaoKey);
		}
		if(key1!=null){
			query.eq(CiCinema.KEY1,key1);
		}
		if(key2!=null){
			query.eq(CiCinema.KEY2,key2);
		}
		if(key3!=null){
			query.eq(CiCinema.KEY3,key3);
		}
		if(openTime!=null){
			query.eq(CiCinema.OPEN_TIME,openTime);
		}
		if(areaCode!=null){
			query.eq(CiCinema.AREA_CODE,areaCode);
		}
		if(areaName!=null){
			query.eq(CiCinema.AREA_NAME,areaName);
		}
	
		if(queryBoExt!=null){
			//设置排序
			if(queryBoExt.getOrderColumn()!=null){
				if(OrderType.asc.getValue().equalsIgnoreCase(queryBoExt.getOrderType())){
					query.orderByAsc(queryBoExt.getOrderColumn());
				}else if(OrderType.desc.getValue().equalsIgnoreCase(queryBoExt.getOrderType())){
					query.orderByDesc(queryBoExt.getOrderColumn());
				}
			}
		}
		return query;
	}

		
	public Integer getId() {
        return id;
	}

	public void setId(Integer id) {
        this.id = id;
    }
		
	public String getCode() {
        return code;
	}

	public void setCode(String code) {
        this.code = code;
    }
		
	public String getName() {
        return name;
	}

	public void setName(String name) {
        this.name = name;
    }
		
	public String getMgCode() {
        return mgCode;
	}

	public void setMgCode(String mgCode) {
        this.mgCode = mgCode;
    }
		
	public String getContactMan() {
        return contactMan;
	}

	public void setContactMan(String contactMan) {
        this.contactMan = contactMan;
    }
		
	public String getMphone() {
        return mphone;
	}

	public void setMphone(String mphone) {
        this.mphone = mphone;
    }
		
	public String getTphone() {
        return tphone;
	}

	public void setTphone(String tphone) {
        this.tphone = tphone;
    }
		
	public String getPostcode() {
        return postcode;
	}

	public void setPostcode(String postcode) {
        this.postcode = postcode;
    }
		
	public String getFax() {
        return fax;
	}

	public void setFax(String fax) {
        this.fax = fax;
    }
		
	public String getEmail() {
        return email;
	}

	public void setEmail(String email) {
        this.email = email;
    }
		
	public String getAddress() {
        return address;
	}

	public void setAddress(String address) {
        this.address = address;
    }
		
	public String getIntro() {
        return intro;
	}

	public void setIntro(String intro) {
        this.intro = intro;
    }
		
	public String getOrgCode() {
        return orgCode;
	}

	public void setOrgCode(String orgCode) {
        this.orgCode = orgCode;
    }
		
	public String getCompany() {
        return company;
	}

	public void setCompany(String company) {
        this.company = company;
    }
		
	public String getCinemas() {
        return cinemas;
	}

	public void setCinemas(String cinemas) {
        this.cinemas = cinemas;
    }
		
	public String getStatus() {
        return status;
	}

	public void setStatus(String status) {
        this.status = status;
    }
		
	public String getCreateUser() {
        return createUser;
	}

	public void setCreateUser(String createUser) {
        this.createUser = createUser;
    }
		
	public Date getCreateTime() {
        return createTime;
	}

	public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
		
	public String getUpdateUser() {
        return updateUser;
	}

	public void setUpdateUser(String updateUser) {
        this.updateUser = updateUser;
    }
		
	public Date getUpdateTime() {
        return updateTime;
	}

	public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
		
	public Date getSyncTime() {
        return syncTime;
	}

	public void setSyncTime(Date syncTime) {
        this.syncTime = syncTime;
    }
		
	public String getUid() {
        return uid;
	}

	public void setUid(String uid) {
        this.uid = uid;
    }
		
	public String getMerchantCode() {
        return merchantCode;
	}

	public void setMerchantCode(String merchantCode) {
        this.merchantCode = merchantCode;
    }
		
	public String getMerchantKey() {
        return merchantKey;
	}

	public void setMerchantKey(String merchantKey) {
        this.merchantKey = merchantKey;
    }
		
	public String getUsbkey() {
        return usbkey;
	}

	public void setUsbkey(String usbkey) {
        this.usbkey = usbkey;
    }
		
	public Date getStatusUpdateTime() {
        return statusUpdateTime;
	}

	public void setStatusUpdateTime(Date statusUpdateTime) {
        this.statusUpdateTime = statusUpdateTime;
    }
		
	public String getHapiaoKey() {
        return hapiaoKey;
	}

	public void setHapiaoKey(String hapiaoKey) {
        this.hapiaoKey = hapiaoKey;
    }
		
	public String getKey1() {
        return key1;
	}

	public void setKey1(String key1) {
        this.key1 = key1;
    }
		
	public String getKey2() {
        return key2;
	}

	public void setKey2(String key2) {
        this.key2 = key2;
    }
		
	public String getKey3() {
        return key3;
	}

	public void setKey3(String key3) {
        this.key3 = key3;
    }
		
	public Date getOpenTime() {
        return openTime;
	}

	public void setOpenTime(Date openTime) {
        this.openTime = openTime;
    }
		
	public String getAreaCode() {
        return areaCode;
	}

	public void setAreaCode(String areaCode) {
        this.areaCode = areaCode;
    }
		
	public String getAreaName() {
        return areaName;
	}

	public void setAreaName(String areaName) {
        this.areaName = areaName;
    }


	public QueryBoExt getQueryBoExt() {
		return queryBoExt;
	}

	public void setQueryBoExt(QueryBoExt queryBoExt) {
		this.queryBoExt = queryBoExt;
	}

	public static class QueryBoExt {
		/**
		 * 一般情况下只需要单个列的排序
		 */
		private String orderColumn;

		/**
		 * asc / desc
		 */
		private String orderType = OrderType.asc.getValue();

		public String getOrderColumn() {
			return orderColumn;
		}

		public void setOrderColumn(String orderColumn) {
			this.orderColumn = orderColumn;
		}

		public String getOrderType() {
			return orderType;
		}

		public void setOrderType(String orderType) {
			this.orderType = orderType;
		}
	}

	public enum OrderType{
		asc("正序","asc"),
		desc("倒序","desc");
		private String name;
		private String value;

		public String getName() {
			return name;
		}

		public String getValue() {
			return value;
		}

		OrderType(String name, String value) {
			this.name = name;
			this.value = value;
		}
	}
}
